package com.cn.mq.receiver;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

import com.cn.mq.config.AmqpConfig;
import com.cn.mq.message.Message;
@Component
public class Receiver {
	@RabbitListener(queues = AmqpConfig.FOO_QUEUE, containerFactory="rabbitListenerContainerFactory")
    public void process(@Payload Message msg) {
		try {
			Thread.sleep(10000);
		       System.out.println("接收消息："+msg.getId());
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    }  
}
